<template>
  <div>
  
    <label>姓名</label>
    <el-input class="width" v-model="name" placeholder="请输入成绩"></el-input>
    <label class="left">语文</label>
    <el-input
      class="width"
      v-model="chinese"
      placeholder="请输入内容"
    ></el-input>
    <label class="left">数学</label>
    <el-input class="width" v-model="math" placeholder="请输入成绩"></el-input>
    <label class="left">英语</label>
    <el-input
      class="width"
      v-model="english"
      placeholder="请输入成绩"
    ></el-input>

    <el-select v-model="synthesize_score_name" placeholder="请选择理综还是文综" class="left">
      <el-option
        v-for="item in synthesizename"
        :key="item.value"
        :label="item.label"
        :value="item.value"
      ></el-option>
    </el-select>
    <el-input
      class="width"
      v-model="synthesize_score"
      placeholder="输入成绩"
    ></el-input>
      <br />
         <br />
        <br />
    <label>总成绩</label>
    <el-input
      class="width"
      v-model="total_score"
      placeholder="请输入成绩"
    ></el-input>

  
    <label  class="left">录取大学</label>
    <el-input
      class="width"
      v-model="university"
      placeholder="请输入内容"
    ></el-input>
    <label class="left">专业</label>
    <el-input
      class="width"
      v-model="professional"
      placeholder="请输入内容"
    ></el-input>
    <label class="left" >录取分数线</label>
    <el-input
      class="width"
      v-model="entry_score"
      placeholder="请输入内容"
    ></el-input>
    <br />
      <br />
        <br />
    <el-button type="primary" plain @click="submitquestion" class="auto">录入</el-button>
  </div>
</template>
<script>
export default {
  data() {
    return {
      name: "",
      chinese: "",
      math: "",
      english: "",
      //理综/文综成绩
      synthesize_score: "",
      //理综还是文综
      synthesize_score_name: "",
      total_score: "",
      university: "",
      professional: "",
      entry_score: "",
      synthesizename: [
        {
          value: "理综",
          label: "理综",
        },
        {
          value: "文综",
          label: "文综",
        },
      ],
    };
  },
  methods: {
    submitquestion() {
       console.log(this.name);
    

      const h = this.$createElement;
      this.$msgbox({
        title: "确认提示",
        message: "你确认录入吗",
        showCancelButton: true,
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        beforeClose: (action, instance, done) => {
          if (action === "confirm") {
            instance.confirmButtonLoading = true;
            instance.confirmButtonText = "执行中...";

            this.$axios
              .get(
                "http://localhost:8080/nceeEntering",
                //get请求参数
                {
                  params: {
                    name: this.name,
                    chinese: this.chinese,
                    math:this.math,
                    english: this.english,
                    //理综/文综成绩
                    synthesize_score: this.synthesize_score,
                    //理综还是文综
                    synthesize_score_name:this.synthesize_score_name,
                    total_score: this.total_score,
                    university:this.university,
                    professional: this.professional,
                    entry_score: this.entry_score,
                  },
                }
              )
              .then((resp) => {
              
                this.message = resp.data;
              });

            setTimeout(() => {
              done();
              setTimeout(() => {
                instance.confirmButtonLoading = false;
              }, 300);
            }, 1000);
          } else {
            done();
          }
        },
      }).then((action) => {
        if (this.message == 200) {
          this.$message({
            message: "录入成功！",
            type: "success",
          });
        } else {
          this.$message({
            message: "录入失败，请重新录入！",
          });
        }
      });
    },
  },
};

</script>
<style scoped>
.width {
  width: 100px;
}
.left{
  padding-left: 20px;
}
.auto{
  margin-left: 300px;
}
</style>
